package com.yuanchu.store.client;

import com.yuanchu.store.entity.YoshopGoodsEntity;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * @version: 1.0
 * @Author: adan
 * @description:
 * @date: 2024-01-24 11:56
 */
@Slf4j
@Component
public class FeignGoodsServiceClientFallbackFactory implements FallbackFactory<FeignGoodsClient> {
    @Override
    public FeignGoodsClient create(Throwable throwable) {
        return new FeignGoodsClient() {

            @Override
            public List<YoshopGoodsEntity> queryGoodsByCategoryId(Integer categoryId) {
                log.error("Feign调用商品服务异常:{}", throwable.getMessage());
                return null;
            }

            @Override
            public YoshopGoodsEntity queryGoodsInfo(Integer goodsId, String goodsSkuId) {
                return null;
            }

            @Override
            public long queryTotalGoods() {
                return 0;
            }

            @Override
            public long querySoldOutGoodsTotal() {
                return 0;
            }

            @Override
            public List<Map<String, Object>> querySaleGoodsList() {
                return null;
            }

            @Override
            public String queryGoodsName(int goodsId) {
                return null;
            }


        };
    }
}
